package com.ruoyi.project.beautyflower.loanApplication.service;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.beautyflower.loanApplication.mapper.LoanApplicationMapper;
import com.ruoyi.project.beautyflower.loanApplication.domain.LoanApplication;
import com.ruoyi.project.beautyflower.loanApplication.service.ILoanApplicationService;
import com.ruoyi.common.support.Convert;

/**
 * 用户借款申请 服务层实现
 * 
 * @author lxs
 * @date 2018-10-13
 */
@Service
public class LoanApplicationServiceImpl implements ILoanApplicationService 
{
	@Autowired
	private LoanApplicationMapper loanApplicationMapper;

	/**
     * 查询用户借款申请信息
     * 
     * @param id 用户借款申请ID
     * @return 用户借款申请信息
     */
    @Override
	public LoanApplication selectLoanApplicationById(Integer id)
	{
	    return loanApplicationMapper.selectLoanApplicationById(id);
	}
	
	/**
     * 查询用户借款申请列表
     * 
     * @param loanApplication 用户借款申请信息
     * @return 用户借款申请集合
     */
	@Override
	public List<LoanApplication> selectLoanApplicationList(LoanApplication loanApplication)
	{
	    return loanApplicationMapper.selectLoanApplicationList(loanApplication);
	}
	
    /**
     * 新增用户借款申请
     * 
     * @param loanApplication 用户借款申请信息
     * @return 结果
     */
	@Override
	public int insertLoanApplication(LoanApplication loanApplication)
	{
	    return loanApplicationMapper.insertLoanApplication(loanApplication);
	}
	
	/**
     * 修改用户借款申请
     * 
     * @param loanApplication 用户借款申请信息
     * @return 结果
     */
	@Override
	public int updateLoanApplication(LoanApplication loanApplication)
	{
	    return loanApplicationMapper.updateLoanApplication(loanApplication);
	}

	/**
     * 删除用户借款申请对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteLoanApplicationByIds(String ids)
	{
		return loanApplicationMapper.deleteLoanApplicationByIds(Convert.toStrArray(ids));
	}



	/**
	 * 根据用户id查询最近一次的借款申请记录
	 * @param userId
	 * @return
	 */
	@Override
	public List<LoanApplication> selectLoanApplicationByUsetId(Integer userId) {
		return loanApplicationMapper.selectLoanApplicationByUsetId(userId);
	}

}
